DAY17:A Needle in the Haystack


Posted by birdbirdmurmur on 2023-07-31

題目連結

A Needle in the Haystack

解法

function findNeedle(haystack) {
  return "found the needle at position " + haystack.indexOf("needle");
}

筆記

如何快速找到陣列中的索引? indexOf()
直接返回字串


#javascript #Codewars #indexOf







Related Posts

關於 React 小書:若非 bind,事件監聽無法透過 this 取得實例

關於 React 小書:若非 bind,事件監聽無法透過 this 取得實例

React-[建立開發環境篇]-安裝vite & 將vite專案打包並部署

React-[建立開發環境篇]-安裝vite & 將vite專案打包並部署

[27-1] 強制轉型 - 番外篇 ( 運算子預設的規定 ex: ==、+ )

[27-1] 強制轉型 - 番外篇 ( 運算子預設的規定 ex: ==、+ )


Comments